package com.ocom.payconfig.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ocom.common.entity.payconfig.CouponsItem;
import com.ocom.common.vo.payconfig.CouponsItemRVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 赠券项目
 * 
 * @author js
 * @email junshu@qq.com
 * @date 2023-07-14
 */
@Mapper
public interface IDaoCouponsItem extends BaseMapper<CouponsItem> {
    @Select("SELECT i.item_id AS couponsItemId , item_name AS couponsItemName, start_date AS startDate , stop_date AS stopDate ,\n" +
            "i.voucher_type_id AS voucherTypeId , t.voucher_type_name AS voucherTypeName,\n" +
            "t.par_value AS parValue, i.`status` , `mode`\n" +
            "FROM coupons_item i LEFT JOIN voucher_type t ON t.voucher_type_id = i.voucher_type_id\n" +
            "WHERE i.com_id = #{comId}\n" +
            "ORDER BY item_id DESC ")
    List<CouponsItemRVo> couponsItem(Long comId);
}
